﻿//-----------------------------------------------------------------------
// <copyright>
// This file is subject to the terms and conditions of the Microsoft Public License (MS-PL).
// See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL for more details.
// </copyright>
//----------------------------------------------------------------------- 
using System.Collections.Generic;
using Fulcrum.ControlGenerator;

namespace Fulcrum.UnitTests.ControlGenerator
{
    static class MockConfigurationHelp
    {
        public static MockControlGeneratorConfiguration CreateGeneratorConfig()
        {
            var generatorConfig = new MockControlGeneratorConfiguration();

            generatorConfig.Company = "My Company";
            generatorConfig.Copyright = "A Copyright";
            generatorConfig.Namespace = "Generator.Namespace";
            generatorConfig.OptionalTemplatePartFactory = "OptionalTemplatePartFactory";
            generatorConfig.RoutedPropertyEventArgsFactory = "RoutedPropertyEventArgsFactory";
            generatorConfig.TemplatePartFactory = "TemplatePartFactory";

            return generatorConfig;
        }

        public static MockControlConfiguration CreateControlConfig(string name)
        {
            var controlConfig = new MockControlConfiguration();

            controlConfig.AutomationPeerArguments = "this";
            controlConfig.AutomationPeerName = "AutomationPeer";
            controlConfig.HasAutomationPeer = true;
            controlConfig.LocalizationCategory = System.Windows.LocalizationCategory.CheckBox;
            controlConfig.LocalizationModifiability = System.Windows.Modifiability.Modifiable;
            controlConfig.LocalizationReadability = System.Windows.Readability.Inherit;
            controlConfig.Location = "ALocation\\AnotherLocation";
            controlConfig.Name = name;
            controlConfig.Namespace = "Control.Namespace";
            controlConfig.OverrideStyleMetadata = true;
            controlConfig.PropertyChangedEventType = PropertyChangedEventType.DotNetEvent;
            controlConfig.Remarks = "some remarks";
            controlConfig.Summary = "some summary";

            var attachedDPs = new List<IAttachedDependencyPropertyConfiguration>();
            attachedDPs.Add(CreateAttachedDependencyPropertyConfig("Z-ADP1", "int"));
            attachedDPs.Add(CreateAttachedDependencyPropertyConfig("A-ADP2", "char"));
            controlConfig.AttachedDependencyProperties = attachedDPs;

            var DPs = new List<IDependencyPropertyConfiguration>();
            DPs.Add(CreateDependencyPropertyConfig("Z-DP1", "int"));
            DPs.Add(CreateDependencyPropertyConfig("A-DP2", "char"));
            controlConfig.DependencyProperties = DPs;

            var routedEvents = new List<IRoutedEventConfiguration>();
            routedEvents.Add(CreateRoutedEventConfig("Z-RE1"));
            routedEvents.Add(CreateRoutedEventConfig("A-RE2"));
            controlConfig.RoutedEvents = routedEvents;

            var routedCommands = new List<IRoutedCommandBindingConfiguration>();
            routedCommands.Add(CreateRoutedCommandConfig("Z-RC1"));
            routedCommands.Add(CreateRoutedCommandConfig("A-RC2"));
            controlConfig.RoutedCommands = routedCommands;

            var routedCommandBindings = new List<IRoutedCommandBindingConfiguration>();
            routedCommandBindings.Add(CreateRoutedCommandBindingConfig("Z-RCB1"));
            routedCommandBindings.Add(CreateRoutedCommandBindingConfig("A-RCB2"));
            controlConfig.RoutedCommandBindings = routedCommandBindings;

            var usingNamespaces = new List<string>();
            usingNamespaces.Add("ZNamespace");
            usingNamespaces.Add("ANamespace");
            controlConfig.UsingNamespaces = usingNamespaces;

            var templateParts = new List<ITemplatePartConfiguration>();
            templateParts.Add(CreateTemplatePartConfig("Z-TP1", "int"));
            templateParts.Add(CreateTemplatePartConfig("A-TP2", "int"));
            controlConfig.TemplateParts = templateParts;

            return controlConfig;
        }

        public static MockTemplatePartConfiguration CreateTemplatePartConfig(string name, string type)
        {
            var templatePart = new MockTemplatePartConfiguration();

            templatePart.Description = "TP description";
            templatePart.Name = name;
            templatePart.Optional = false;
            templatePart.Type = type;

            return templatePart;
        }

        public static MockDependencyPropertyConfiguration CreateDependencyPropertyConfig(string name, string type)
        {
            var config = new MockDependencyPropertyConfiguration();

            config.Description = "DP description";
            config.Name = name;
            config.Type = type;
            config.CoerceValue = false;
            config.DefaultValue = "defaultValue";

            config.MetadataOptions = new List<string>();

            return config;
        }

        public static MockAttachedDependencyPropertyConfiguration CreateAttachedDependencyPropertyConfig(string name, string type)
        {
            var config = new MockAttachedDependencyPropertyConfiguration();

            config.Name = name;
            config.Type = type;
            config.CoerceValue = false;
            config.DefaultValue = "defaultValue";

            config.MetadataOptions = new List<string>();

            return config;
        }

        public static MockRoutedCommandBindingConfiguration CreateRoutedCommandConfig(string name)
        {
            var config = new MockRoutedCommandBindingConfiguration();

            config.Name = name;

            return config;
        }

        public static MockRoutedCommandBindingConfiguration CreateRoutedCommandBindingConfig(string name)
        {
            var config = new MockRoutedCommandBindingConfiguration();

            config.Name = name;

            return config;
        }

        public static MockRoutedEventConfiguration CreateRoutedEventConfig(string name)
        {
            var config = new MockRoutedEventConfiguration();

            config.Name = name;

            return config;
        }


    }
}
